#ifndef _KC_SMTPSTANDARDS_H__KC_
#define _KC_SMTPSTANDARDS_H__KC_

#include <string>
#include <map>
#include <boost/assign/list_of.hpp>
#include "Reply.h"
#include "ReplyType.h"
#include "../../config/Config.h"

namespace kc_sf
{
	const int DEF_SENDER_TIMEOUT_S = 300;
	const int DEF_RECEIVER_TIMEOUT_S = 300;
	const std::string CRLF = "\r\n";
	const std::string WSP = CRLF + " \t";
	const std::string EOM = CRLF + "." + CRLF;
	const std::string RECEIVER_FQDN_NAME = Config::getInstance().cMyDomain;
	const unsigned int MAX_LINE_LENGTH = 1024;

	typedef std::map<ReplyType, Reply> ReplyTypeMap;

	const ReplyTypeMap StandardReplies =
	boost::assign::map_list_of
		( Ok_SystemStatus, Reply( 211, "" ) )
		( Ok_Greet, Reply( 220, RECEIVER_FQDN_NAME + " ESMTP Service ready" ) )
		( Ok_GoAhead, Reply( 220, "Go ahead" ) )
		( Ok_Closing, Reply( 221, "Service closing transmission channel" ) )
		( Ok_AuthenticationSuccess, Reply( 235, "Ok, go ahead" ) )
		( Ok_Ready, Reply( 250, RECEIVER_FQDN_NAME ) )
		( Ok_Ok, Reply( 250, "Ok" ) )
		( Ok_Forward, Reply( 251, "User not local will forward to " ) )
		( Ok_NoVrfy, Reply( 252, "Cannot VRFY user, but will accept message and attempt delivery" ) )
		( More_Authentication, Reply( 334 ) )
		( More_AuthenticationLogin, Reply( 334, "VXNlcm5hbWU6" ) )
		( More_AuthenticationPasswd, Reply( 334, "UGFzc3dvcmQ6" ) )
		( More_StartMail, Reply( 354, "Start mail input. End with <CRLF>.<CRLF>" ) )
		( Tmp_NotAvailable, Reply( 421, RECEIVER_FQDN_NAME + " Service not available" ) )
		( Tmp_Closing, Reply( 421, RECEIVER_FQDN_NAME + " Closing transmission channel" ) )
		( Tmp_MailboxUnavailable, Reply( 450, "Mailbox unavailable" ) )
		( Tmp_Aborted, Reply( 451, "Requested action aborted: local error in processing. Closing connection" ) )
		( Tmp_Timeout, Reply( 451, "Timeout - closing connection." ) )
		( Tmp_NotEnoughMemory, Reply( 452, "Requested action not taken: insufficient system storage" ) )
		( Tmp_StartTLSRepeat, Reply( 454, "STARTTLS may not be repeated" ) )
		( Tmp_CannotProcessParams, Reply( 455, "Server unable to accommodate parameters" ) )
		( No_SyntaxError, Reply( 500, "Syntax error" ) )
		( No_Unrecognized, Reply( 500, "Command unrecognized" ) )
		( No_ParamsSyntaxError, Reply( 501, "Syntax error in parameters or arguments" ) )
		( No_AuthenticationSyntaxError, Reply( 501, "Cannot decode response " ) )
		( No_NotImplemented, Reply( 502, "Command not implemented" ) )
		( No_BadCommandsSeq, Reply( 503, "Bad sequence of commands" ) )
		( No_UnrecognizedParam, Reply( 504, "Command parameter not implemented" ) )
		( No_AuthenticationRequired, Reply( 530, "Authentication required." ) )
		( No_AuthenticationFailure, Reply( 535, "Username and/or password not accepted." ) )
		( No_EncryptionRequired, Reply( 538, "Encryption required for requested authentication mechanism" ) )
		( No_NoUser, Reply( 550, "No such user here" ) )
		( No_Forward, Reply( 551, "User not local please try " ) )
		( No_Aborted, Reply( 552, "Requested mail action aborted: exceeded storage allocation" ) )
		( No_NoMailbox, Reply( 553, "Requested action not taken: mailbox name not allowed" ) )
		( No_Failure, Reply( 554, "Transaction failed" ) )
		( No_MailParamsUnrecognized, Reply( 555, "MAIL FROM parameters not recognized or not implemented" ) )
		( No_RcptParamsUnrecognized, Reply( 555, "RCPT TO parameters not recognized or not implemented" ) );
}

#endif // _KC_SMTPSTANDARDS_H__KC_
